	<script type="text/javascript" src="http://www.google.com/jsapi"></script>
	<script type="text/javascript">
		// Load google visualization API 
		google.load('visualization', '1', {packages: ['table']});
		// On load call draw function
		google.setOnLoadCallback(drawVisualization);
		
		function drawVisualization() {
			var visualization,visualization2;
			// All time top earners
			var data = new google.visualization.DataTable();
			data.addColumn('string', 'User Name');
       	    data.addColumn('number', 'Total Amount');
	        data.addColumn('number', 'Change');
	        data.addColumn('string', '');
			{{ table_users_Text }}
			
			// Weekly top earners			 
			var data2 = new google.visualization.DataTable();
			data2.addColumn('string', 'User Name');
       	    data2.addColumn('number', 'Total Amount');
	        data2.addColumn('number', 'Week Change');
	        data2.addColumn('string', '');
			{{ table_users_Text_week }}
			
			visualization = new google.visualization.Table(document.getElementById('table_alltime'));
			visualization.draw(data, {'allowHtml':true,'width':400,'page':'enable'});
			visualization2 = new google.visualization.Table(document.getElementById('table_weekly'));
			visualization2.draw(data2, {'allowHtml':true,'width':400,'page':'enable'});
		}
		
		// JQuery
		function setDialog() {
			$("#dialog").dialog({
				bgiframe: true, autoOpen: false, width:480, height: 350, speed:'slow', modal: true, hide: 'clip', 'resizable': false
				});
		}
		$(document).ready(function(){
		// Dialog to show compare users pop up
			setDialog();
		});
		
		// Initiate call to compare users dialog
		function CompareUsers(sQuery) {
			
			$("#dialog").dialog('destroy');
			
			$("#modalIframeId").remove();
			$("#dialog").remove();
			
			$("body").append('<div id="dialog" title="Dialog Title"></div>');
			$('#dialog').append('<iframe id="modalIframeId" width="100%" height="100%" marginWidth="0" marginHeight="0" frameBorder="0" scrolling="auto" title="Dialog Title"></iframe>');
			
			setDialog();
			
			url="/compareUsers.html?user2=" + sQuery;
			$('#dialog').data('title.dialog', 'Compare Graphs');

			$("#modalIframeId").attr("src",url);
			$('#dialog').dialog('open');
			return false;
		  }
			
	</script>	